import { Component, } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import {PersonalPage} from "../personal/personal";
import {HttpServies} from '../../providers/http-servies';
import 'rxjs/add/operator/toPromise';
import {BalancePage} from "../balance/balance";

import {TurnPage} from "../turn/turn";
import {StarePage} from "../stare/stare";
import {IntegralPage} from "../integral/integral";



@Component({
  selector: 'page-home',
  templateUrl: 'home.html',
  providers:[HttpServies]
})
export class HomePage {


    yeJson:any=[];
    jfJson:any=[];
    yhxxJson:any=[];
     lstJson:any=[{path:'../../assets/imgs/home/01.png'}];

    /*数组 轮播图*/
  ionViewDidLoad() {
      this.http.httpPost('/Home/homepage/slideshow')
          .then(res => {//成功
              if (res && res.code == 1) {
                  console.log(res.msg);
                  this.lstJson = res.data;
              } else {
                  this.http.showErro(res.msg);
              }
          })

      this.getInfo();
       // this.lbtInfo();
  }
  constructor(public navCtrl: NavController, public navParams: NavParams,private http:HttpServies) {

  }
    /*
     *
     * 轮播图
     *
     * */
    lbtInfo(){

    }
  /*
  * 余额.积分
  * */
  getInfo(){
    //余额
    this.http.httpPost('/Home/homepage/balance')
        .then(res => {//成功
          if (res && res.code == 1) {
            console.log(res.msg);
            this.yeJson = res.data;
          } else {
            this.http.showErro(res.msg);
          }
        })
    //积分
    this.http.httpPost('/Home/homepage/integral')
        .then(res => {//成功
          if (res && res.code == 1) {
            console.log(res.msg);
            this.jfJson = res.data;
          } else {
            this.http.showErro(res.msg);
          }
        })
    this.http.httpPost('/Home/index/information')
        .then(res => {//成功
          if (res && res.code == 1) {
            console.log(res.msg);
            this.yhxxJson = res.data;
          } else {
            this.http.showErro(res.msg);
          }
        })
  }


/*
* 余额跳转页面
* */
  yetiaozhuangPage(){
    this.navCtrl.push(BalancePage);
  }
  /*
  * 积分跳转页面
  * */
  jftiaozhuangPage(){
    this.navCtrl.push(IntegralPage);
  }
  /*
  * 转出页面跳转
  * */
  zchuPage(){
    this.navCtrl.push(TurnPage);
  }
  /*
  * 分享页面跳转
  * */
  fxianPage(){
    this.navCtrl.push(StarePage);
}
/*
* 账号设置跳转页面
* */
    tuchudlPage() {
    this.navCtrl.push(PersonalPage);
  }
  /*
  * 手指赚页面
  * */
  SZZPage(){
    this.http.showErro('暂时未开放');
  }
  /*
  * JMA商城
  * */
  JMASCPage(){
    this.http.showErro('暂时未开放');
  }
  /*
  * JMC
  * */
  JMCPage(){
    this.http.showErro('暂时未开放');
  }
  /*
  * 交易跳转
  * */
  FXPage(){
    this.http.showErro('暂时未开放');
  }
}
